﻿using UnityEngine.UIElements;
using UnityEditor;
namespace LitBT
{
    /// <summary>
    /// 节点检查面板
    /// </summary>
    public class InspectorView : VisualElement
    {
        public new class UxmlFactory : UxmlFactory<InspectorView, VisualElement.UxmlTraits> { }
        Editor editor;
        public InspectorView()
        {

        }

        internal void UpdateSelection(NodeView node)
        {
            Clear();

            UnityEngine.Object.DestroyImmediate(editor);
            editor = Editor.CreateEditor(node.node);
            IMGUIContainer container = new IMGUIContainer(() =>
            {
                editor.OnInspectorGUI();
            });
            Add(container);
        }
    }
}